package com.wan37.logic.service.impl;

import com.wan37.logic.dao.RoleDao;
import com.wan37.logic.domain.entity.RoleDO;
import com.wan37.logic.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : luoyong
 * @date : 2020-05-28 14:53
 **/
@Service("roleService")
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleDao roleDao;

    @Override
    public List<RoleDO> getAllRoles() {
        List<RoleDO> lists = roleDao.getAll();
        if (lists != null) {
            return lists;
        } else {
            return null;
        }
    }


    @Override
    public List<RoleDO> getRolesByUserId(String userId) {
        List<RoleDO> lists = roleDao.getRoleByUserId(userId);
        if (lists != null) {
            return lists;
        } else {
            return null;
        }
    }

    @Override
    public boolean update(RoleDO roleDO) {
        return roleDao.update(roleDO);
    }

    @Override
    public boolean save(RoleDO roleDO) {
        return roleDao.add(roleDO);
    }

    @Override
    public boolean delete(RoleDO roleDO) {
        return delete(roleDO);
    }
}
